﻿using System;
using UnityEngine;

// Token: 0x02000368 RID: 872
public class StateManager : MonoBehaviour
{
	// Token: 0x1700038D RID: 909
	// (get) Token: 0x060016BB RID: 5819 RVA: 0x00092B3F File Offset: 0x00090D3F
	public static StateManager instance
	{
		get
		{
			if (StateManager.cachedInstance == null)
			{
				StateManager.cachedInstance = new GameObject("State Manager").AddComponent<StateManager>();
				UnityEngine.Object.DontDestroyOnLoad(StateManager.cachedInstance);
			}
			return StateManager.cachedInstance;
		}
	}

	// Token: 0x060016BC RID: 5820 RVA: 0x00092B74 File Offset: 0x00090D74
	private void Awake()
	{
		this.myData = new PlayerData();
		this.gameSettings = new GameSettings();
		Debug.Log("This is Sizebox v" + global::Version.GetVersionNumber());
	}

	// Token: 0x060016BD RID: 5821 RVA: 0x00092BA0 File Offset: 0x00090DA0
	private void OnApplicationFocus(bool hasFocus)
	{
		if (!GlobalPreferences.BackgroundAudio.value)
		{
			if (hasFocus)
			{
				SoundManager.Mixer.SetFloat("Master", GlobalPreferences.VolumeMaster.value);
			}
			else
			{
				SoundManager.Mixer.SetFloat("Master", -80f);
			}
		}
		if (!GlobalPreferences.BackgroundMaxFps.value && QualitySettings.vSyncCount == 0)
		{
			if (hasFocus)
			{
				Application.targetFrameRate = GlobalPreferences.Fps.value;
			}
			else
			{
				Application.targetFrameRate = 10;
			}
		}
	}

	// Token: 0x04001958 RID: 6488
	public static StateManager cachedInstance;

	// Token: 0x04001959 RID: 6489
	public PlayerData myData;

	// Token: 0x0400195A RID: 6490
	public GameSettings gameSettings;
}
